<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);

return [
    'id' => 'app-api',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'controllerNamespace' => 'api\controllers',
    'timeZone' => 'Asia/Shanghai',
    "modules" => [
        'scenarios' => [
            'class' => 'api\modules\scenarios\Module',
        ]
    ],
    'components' => [
         'urlManager' => [
             'enablePrettyUrl' => true,
             'showScriptName' => false,
             'enableStrictParsing' => false,
             'rules' => [
                 '/index.html' => 'index/proxy',
                 '/' => 'index/proxy',
                 '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
             ]
         ],
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-api', 'httpOnly' => true],
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'redis' => [
            'class' => 'yii\redis\Connection',
            'hostname' => '132.232.5.22',
            'port' => 6379,
            'database' => 0,
        ],
        'errorHandler' => [
            'class' => 'api\components\ErrorHandler',
        ],
    ],
    'params' => $params,
];
